extends Talent
var utils = globalData.infoDs["g_AneHekUtils"]
var cnt = 0
var cnt2 = 0
var r
var bf = null
var bflist = [XLJC,GJJC,LQJC,GSJC,BJJC,SBJC,FYJC,JMJC,ZSJC]
func init():
	name = "胜利旗帜[通用]"

func _connect():
	cnt = 0
	cnt2 = 0
	bf = null
	sys.main.connect("onBattleStart",self,"run")
	sys.main.connect("onBattleEnd",self,"run3")
	sys.main.connect("onCharaDel",self,"run2")

func run():
	var chas = utils.getAllChas(2)
	if cnt:
		for i in chas:
			i.addBuff(bf.new(1,r))
	cnt = chas.size()
	cnt2 = cnt

func run2(cha):
	if cha.isSumm || cha.team == 2:return
	cnt2 -= 1


func run3():
	bf = sys.rndListItem(bflist)
	r = cnt2 * 1.0 / cnt
	
func get_info():
	var txt = "获得战斗胜利后，根据战况，下场战斗获得随机buff【可被驱散】（越惨烈会使得基础加成变得越高）\n"
	if bf:
		#print(r)
		txt += "当前加成：" + bf.new(1,r).info + "\n"
	return txt + "此天赋不需要升级"

class XLJC:
	extends Buff
	func _init(lv,r):
		info = "血量加成"
		attInit()
		id = "XLJC"
		att.maxHpL = 0.15/max(0.2,r)
		info += "[" + str(att.maxHpL * 100) +"%]"

class GJJC:
	extends Buff
	func _init(lv,r):
		info = "攻击加成"
		attInit()
		id = "GJJC"
		att.atkL = 0.15/max(0.2,r)
		att.mgiAtkL = 0.15/max(0.2,r)
		info += "[" + str(att.atkL * 100) +"%]"

class LQJC:
	extends Buff
	func _init(lv,r):
		info = "冷却加成"
		attInit()
		id = "LQJC"
		att.cd = 0.1/max(0.2,r)
		info += "[" + str(att.cd * 100) +"%]"

class GSJC:
	extends Buff
	func _init(lv,r):
		info = "攻速加成"
		attInit()
		id = "GSJC"
		att.spd = 0.2/max(0.2,r)
		info += "[" + str(att.spd * 100) +"%]"
	
class BJJC:
	extends Buff
	func _init(lv,r):
		info = "暴击加成"
		attInit()
		id = "BJJC"
		att.cri = 0.1/max(0.2,r)
		info += "[" + str(att.cri * 100) +"%]"

class SBJC:
	extends Buff
	func _init(lv,r):
		info = "闪避加成"
		attInit()
		id = "SBJC"
		att.dod = 0.1/max(0.2,r)
		info += "[" + str(att.dod * 100) +"%]"

class FYJC:
	extends Buff
	func _init(lv,r):
		info = "防御加成"
		attInit()
		id = "FYJC"
		att.def = 33/max(0.2,r)
		att.mgiDef = 33/max(0.2,r)
		info += "[" + str(att.def) +"点]"

class JMJC:
	extends Buff
	func _init(lv,r):
		info = "免伤加成"
		attInit()
		id = "JMJC"
		att.defR = 0.1/max(0.2,r)
		info += "[" + str(att.defR * 100) +"%]"

class ZSJC:
	extends Buff
	func _init(lv,r):
		info = "增伤加成"
		attInit()
		id = "ZSJC"
		att.atkR = 0.1/max(0.2,r)
		info += "[" + str(att.atkR * 100) +"%]"











